/*Copyright (C) 2009 - 2010 MASSART GAUTHIER

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "../headers.h"

void pom_marche(void) {
	short y = 1, k = 0;

	clear();
	pom_sur_place();

	while(k != 22) {
		mvaddstr(10, y, "     \\\\\\|||||||////      ");
		mvaddstr(11, y, "      \\\\  ~ ~  ///         ");
		mvaddstr(12, y, "       (  @ @  )            ");
		mvaddstr(13, y, "        \\ (_) /            ");
		mvaddstr(14, y, "         \\___/             ");
		mvaddstr(15, y, "          │ │               ");
		mvaddstr(16, y, "       ___│ │___            ");
		mvaddstr(17, y, "      / _     _ \\   (¯¯)   ");
		mvaddstr(18, y, "     / / │   │ \\ \\  / /   ");
		mvaddstr(19, y, "    / /  │   │  \\ \\/ /    ");
		mvaddstr(20, y, "   / /   │   │   \\__/      ");
		mvaddstr(21, y, "  (__)   │   │              ");
		mvaddstr(22, y, "         │ │ │              ");
		mvaddstr(23, y, "         │ │ │              ");
		mvaddstr(24, y, "         │ │\\ \\           ");
		mvaddstr(25, y, "         │ │ \\ \\          ");
		mvaddstr(26, y, "         │ │  │ │           ");
		mvaddstr(27, y, "         │ │  │ │           ");
		mvaddstr(28, y, "         │ │  │ │           ");
		mvaddstr(29, y, "         │ │  │ │           ");
		mvaddstr(30, y, "         │███ │███");
		refresh();
		CSLP_Sleep(160);
		y += 2;
		jouer_son(PAS);
		mvaddstr(10, y, "       \\\\\\|||||||////         ");
		mvaddstr(11, y, "        \\\\  ~ ~  ///           ");
		mvaddstr(12, y, "         (  @ @  )              ");
		mvaddstr(13, y, "          \\ (_) /              ");
		mvaddstr(14, y, "           \\___/               ");
		mvaddstr(15, y, "            │ │                 ");
		mvaddstr(16, y, "         ___│ │___              ");
		mvaddstr(17, y, "        / _     _ \\            ");
		mvaddstr(18, y, "        \\ \\│  (¯¯) \\         ");
		mvaddstr(19, y, "         \\ \\  / / \\ \\       ");
		mvaddstr(20, y, "          \\ \\/ /   \\ \\      ");
		mvaddstr(21, y, "           \\__/│   (__)        ");
		mvaddstr(22, y, "           │ │ │                ");
		mvaddstr(23, y, "           │ │ │                ");
		mvaddstr(24, y, "            \\ \\│              ");
		mvaddstr(25, y, "             \\ \\              ");
		mvaddstr(26, y, "             ││ │               ");
		mvaddstr(27, y, "             /│ │               ");
		mvaddstr(28, y, "            / │ │               ");
		mvaddstr(29, y, "           / /│ │               ");
		mvaddstr(30, y, "          │███│███");
		refresh();
		CSLP_Sleep(160);
		y += 3;
		jouer_son(PAS);
		k++;
	}
	clear();
}
void pom_avancement(short avancement, char matrice[10][55]) {
	short i, j;
	for(j = 0; j != 8; j++) {
		for(i = avancement; i > 0; i--) {
			mvaddch(15 + j, DEFAULT_SCREEN_SIZE_X - avancement + i, matrice[0+j][i-1]);
		}
	}
}
void pom_sur_place() {
	short y = 1, k = 0, avancement = 1;
	char matrice[10][55] = {
		{" ######    #######                             ##      "},
		{"##    ##  ##     ##                             ##     "},
		{"##        ##     ##                              ##    "},
		{"##   #### ##     ##    #########################  ##   "},
		{"##    ##  ##     ##                              ##    "},
		{"##    ##  ##     ##                             ##     "},
		{" ######    #######                             ##      "},
		{"                                                       "},
		{"                                                       "},
		{"                                                       "},
	};

	while(avancement <= 56) {
		mvaddstr(10, 1, "     \\\\\\|||||||////      ");
		mvaddstr(11, 1, "      \\\\  ~ ~  ///         ");
		mvaddstr(12, 1, "       (  @ @  )            ");
		mvaddstr(13, 1, "        \\ (_) /            ");
		mvaddstr(14, 1, "         \\___/             ");
		mvaddstr(15, 1, "          │ │               ");
		mvaddstr(16, 1, "       ___│ │___            ");
		mvaddstr(17, 1, "      / _     _ \\   (¯¯)   ");
		mvaddstr(18, 1, "     / / │   │ \\ \\  / /   ");
		mvaddstr(19, 1, "    / /  │   │  \\ \\/ /    ");
		mvaddstr(20, 1, "   / /   │   │   \\__/      ");
		mvaddstr(21, 1, "  (__)   │   │              ");
		mvaddstr(22, 1, "         │ │ │              ");
		mvaddstr(23, 1, "         │ │ │              ");
		mvaddstr(24, 1, "         │ │\\ \\           ");
		mvaddstr(25, 1, "         │ │ \\ \\          ");
		mvaddstr(26, 1, "         │ │  │ │           ");
		mvaddstr(27, 1, "         │ │  │ │           ");
		mvaddstr(28, 1, "         │ │  │ │           ");
		mvaddstr(29, 1, "         │ │  │ │           ");
		mvaddstr(30, 1, "         │███ │███          ");
		pom_avancement(avancement, matrice);
		avancement += 2;
		refresh();
		CSLP_Sleep(175);
		jouer_son(PAS);
		mvaddstr(10, 1, "     \\\\\\|||||||////         ");
		mvaddstr(11, 1, "      \\\\  ~ ~  ///           ");
		mvaddstr(12, 1, "       (  @ @  )              ");
		mvaddstr(13, 1, "        \\ (_) /              ");
		mvaddstr(14, 1, "         \\___/               ");
		mvaddstr(15, 1, "          │ │                 ");
		mvaddstr(16, 1, "       ___│ │___              ");
		mvaddstr(17, 1, "      / _     _ \\            ");
		mvaddstr(18, 1, "      \\ \\│  (¯¯) \\         ");
		mvaddstr(19, 1, "       \\ \\  / / \\ \\       ");
		mvaddstr(20, 1, "        \\ \\/ /   \\ \\      ");
		mvaddstr(21, 1, "         \\__/│   (__)        ");
		mvaddstr(22, 1, "         │ │ │                ");
		mvaddstr(23, 1, "         │ │ │                ");
		mvaddstr(24, 1, "          \\ \\│              ");
		mvaddstr(25, 1, "           \\ \\              ");
		mvaddstr(26, 1, "           │\\ \\               ");
		mvaddstr(27, 1, "           / │ │               ");
		mvaddstr(28, 1, "          / /│ │               ");
		mvaddstr(29, 1, "         / / │ │               ");
		mvaddstr(30, 1, "        │███ │███              ");
		pom_avancement(avancement, matrice);
		avancement += 2;
		refresh();
		CSLP_Sleep(175);
		jouer_son(PAS);
	}
}
